from django.conf.urls.defaults import *

# Uncomment the next two lines to enable the admin:
from django.contrib import admin
import settings

admin.autodiscover()

urlpatterns = patterns('',
    (r'^$',                          'pyfacture.views.pyfacture'),

    (r'^loginform/$',                'pyfacture.views.display_login'),
    (r'^login/$',                    'pyfacture.views.auth_login'),
    (r'^logout/$',                   'pyfacture.views.auth_logout'),

    (r'^invoice/new/$',              'pyfacture.invoice.view.new'),
    (r'^invoice/view/(\d{8})/$',     'pyfacture.invoice.view.view'),
    (r'^invoice/view/$',             'pyfacture.invoice.view.view_default'),
    (r'^invoice/pdf/(\d{8})/$',      'pyfacture.invoice.view.pdf'),
    (r'^invoice/save/$',             'pyfacture.invoice.view.save'),

    (r'^timesheet/new/(\d+)/$',      'pyfacture.timesheet.view.new'),
    (r'^timesheet/new/$',            'pyfacture.timesheet.view.new_default'),
    (r'^timesheet/edit/(\d+)/$',     'pyfacture.timesheet.view.edit'),
    (r'^timesheet/view/(\d+)/$',     'pyfacture.timesheet.view.view'),
    (r'^timesheet/view/$',           'pyfacture.timesheet.view.view_default'),
    (r'^timesheet/pdf/(\d+)/$',      'pyfacture.timesheet.view.pdf'),
    (r'^timesheet/save/$',           'pyfacture.timesheet.view.save'),
    (r'^timesheet/forInvoiceLine/(\d+)/$', 'pyfacture.timesheet.view.forInvoiceLine'),

    (r'^client/autocomplete/$',      'pyfacture.client.view.autocomplete'),
    (r'^client/save/$',              'pyfacture.client.view.save'),
    (r'^client/(\d+)/address/save/$','pyfacture.client.view.saveAddress'),

    (r'^contract/new/$',             'pyfacture.contract.view.new'),
    (r'^contract/view/(\d+)/$',      'pyfacture.contract.view.view'),
    (r'^contract/view/$',            'pyfacture.contract.view.view_default'),
    (r'^contract/save/$',            'pyfacture.contract.view.save'),

    (r'^customer/autocomplete/$',    'pyfacture.customer.view.autocomplete'),
    (r'^customer/save/$',            'pyfacture.customer.view.save'),
    
    (r'^admin/', include(admin.site.urls)),
    (r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.STATIC_ROOT}),
)
